package com.nan.leetcode.剑指offer第二版.用两个栈实现队列_009;

import java.util.LinkedList;
import java.util.Stack;

public class CQueue {
    public Stack<Integer> out;
    public Stack<Integer> in;
    public CQueue() {
        this.in = new Stack<>();
        this.out = new Stack<>();
    }

    public void appendTail(int value) {
        in.push(value);
    }

    public int deleteHead() {
        if(out.isEmpty()&& in.isEmpty()){
           return -1;
        }
        if(out.isEmpty()){
            for (int i=0;i< in.size();i++) {
                out.push(in.pop());
            }
        }
        return out.pop();
    }
}
